def insert_sort(nums):
    for i in range(1, len(nums)):
        tmp = nums[i]
        j = i - 1
        while j >= 0 and nums[j] > tmp:
            nums[j + 1] = nums[j]
            j -= 1
        nums[j + 1] = tmp


if __name__ == "__main__":
    nums = [2, 4, 1, 3]
    insert_sort(nums)
    print(nums)
